package cn.zhangyong.opengl30learn;

import android.graphics.Color;
import android.opengl.GLSurfaceView;
import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;

import cn.zhangyong.opengl30learn.baselearnbackgroud1.color.NativeColorRenderer;

public abstract class BaseActivity extends AppCompatActivity {

    private GLSurfaceView mGLSurfaceView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setupViews();
    }

    private void setupViews() {
        mGLSurfaceView = new GLSurfaceView(this);
        setContentView(mGLSurfaceView);
        //设置版本
        mGLSurfaceView.setEGLContextClientVersion(3);
        //GLSurfaceView.Renderer renderer = new ColorRenderer(Color.GRAY);
        GLSurfaceView.Renderer renderer = createRender();
        mGLSurfaceView.setRenderer(renderer);
    }

    protected abstract GLSurfaceView.Renderer createRender();
}
